package com.yzt;

public class CatAndDog {
    private String name;
    public CatAndDog(){}
    public CatAndDog(String name){
        this.name = name;
    }
    public void eat(){
        if (name.equals("小猫")) {
            System.out.print(name + "吃小鱼干,");
            return;
        }
        System.out.print(name + "吃骨头,");
    }
    public void sleep() {
        if (name.equals("小猫")) {
            System.out.print( "甜甜的睡着了。");
            return;
        }
        System.out.print( "憨憨的睡着了");
    }
}
